<?php 

/*
 * @version		$Id: default_videos.php 1.1 2012-03-18 $
 * @package		Joomla
 * @copyright   Copyright (C) 2012-2013 MrVinoth
 * @license     GNU/GPL http://www.gnu.org/licenses/gpl-2.0.html
*/

defined('_JEXEC') or die('Restricted access'); 

if($items['link'] != '') {
   $link = $items['link'];	
} else {
   $link = 'index.php?option=com_allvideoshare&view=video';
}
$qs      = (!strpos($link, '?')) ? '?' : '&';
$videos  = $items['data'];
$more    = true;
$count   = $items['columns'] * $items['rows'];
if(count($videos) < $count) {
	$more  = false;
	$count = count($videos);
}
$row     = 0;
$column  = 0;

?>
<style type="text/css">
#avs_gallery .avs_thumb {
	background-color:#FFFFFF;
	border:1px solid #EEE;
	padding:10px;
	float:left;
	margin:7px;
	width:<?php echo $items['thumb_width']; ?>px;
}
#avs_gallery .avs_thumb a {
	text-decoration:none;
}
#avs_gallery .avs_thumb .image {
	display:block;
}
#avs_gallery .avs_thumb .arrow {
	position:absolute;
	width:29px;
	height:26px;
	margin-left:59px;
	margin-top:28px;
	opacity:0.5;
}
#avs_gallery .avs_thumb .title {
	margin:5px 0px 0px 0px;
	padding:0px;
	display:block;
	font-family:Arial;
	font-size:12px;
	color:#444;
	font-weight:bold;
}
#avs_gallery .avs_thumb .views {
	margin:0px;
	padding:0px;
	display:block;
	font-family:Arial;
	font-size:11px;
	color:#777;
}
</style>
<div id="avs_gallery">
  <?php 
  	if(!count($videos)) echo JText::_('ITEM_NOT_FOUND');
  	for ($i=0, $n=$count; $i < $n; $i++) {   
		$clear = ''; 
    	if($column >= $items['columns']) {
			$clear  = '<div style="clear:both;"></div>';
			$column = 0;
			$row++;		
		}
		$column++;
		echo $clear;
  ?>
  <div class="avs_thumb"> <a href="<?php echo JRoute::_($link.$qs.'slg='.$videos[$i]->slug); ?>"> <img class="arrow" src="components/com_allvideoshare/assets/play.gif" border="0" style="margin-left:<?php echo ($items['thumb_width'] / 2) - 15; ?>px; margin-top:<?php echo ($items['thumb_height'] / 2) - 13; ?>px;" /> <img class="image" src="<?php echo $videos[$i]->thumb; ?>" width="<?php echo $items['thumb_width']; ?>" height="<?php echo $items['thumb_height']; ?>" title="<?php echo JText::_('CLICK_TO_VIEW') . ' : ' . $videos[$i]->title; ?>" border="0" /> <span class="title"><?php echo $videos[$i]->title; ?></span> <span class="views"><strong>views : </strong><?php echo $videos[$i]->views; ?></span> </a> </div>
  <?php } ?>
</div>
<div style="clear:both"></div>
<?php if($more == true) { ?>
<div class="avsmore"><a href="<?php echo JRoute::_($link.$qs.'orderby='.$items['orderby']); ?>"><?php echo JText::_('MORE'); ?></a></div>
<?php } ?>